<template>
  <!-- 种公期初 -->
  <div>
    种公耳号：<el-input v-model="form.sleepInforIds" style="width: 180px"></el-input>
    &emsp;

    <el-button :icon="Search" type="primary" @click="getDatas()" >查询</el-button>
    <el-button :icon="Plus" type="success" @click="router.push('/MaleBeginList')" >新增</el-button><br><br>
  </div>
  <el-table :header-cell-style="{ height: '100px', fontSize: '13px',color:'black' , backgroundColor: 'antiquewhite' }" :data="tableData" border style="width: 100%;">
    <el-table-column  label="序号" >
      <template #default="{$index}" >
        {{ $index+1 }}
      </template>
    </el-table-column>
    <el-table-column   prop="proCode" label="单据号" width="150" />
    <el-table-column   prop="proData" label="期初日期" width="180"  >
      <template v-slot="scope">
        {{ scope.row.proData.substring(0,19).replace("T"," ") }}
      </template>
    </el-table-column>
    <el-table-column   prop="earNumber" label="耳号" width="130" />
    <el-table-column   prop="cottageName" label="栋舍名称" width="130" />
    <el-table-column   prop="fieIdName" label="栏位" width="100" />
    <el-table-column   prop="proBeginWeight" label="重量（公斤）" width="130" />
    <el-table-column   prop="createName" label="创建人" />
    <el-table-column   prop="createTime" label="创建时间" width="180" >
 <template v-slot="scope" >
        {{ scope.row.createTime.substring(0,19).replace("T"," ") }}
      </template>
    </el-table-column>
    <el-table-column   prop="updateId" label="修改人" />
    <el-table-column   prop="updateTime" label="修改时间" width="180" >
 <template v-slot="scope" >
         {{ scope.row.updateTime==null? "":scope.row.updateTime.substring(0,19).replace("T"," ") }}
      </template>
    </el-table-column>
    <el-table-column   prop="examId" label="审核人" />
    <el-table-column   prop="examTime" label="审核时间" width="180" >
 <template v-slot="scope" >
         {{ scope.row.examTime==null? "":scope.row.examTime.substring(0,19).replace("T"," ") }}
      </template>
    </el-table-column>
    <el-table-column   label="操作" width="120" >
      <template v-slot="scope" >
        <el-link type="primary"   >审核</el-link>
        <el-link  type="primary" >编辑</el-link>
        <el-link  type="primary" >删除</el-link>
      </template>
    </el-table-column>
  </el-table>

  <el-pagination
        v-model:current-page="form.pageIndex"
        v-model:page-size="form.pageSize"
        :page-sizes="[5, 10, 15, 20]"
        :background="true"
        layout="total, sizes, prev, pager, next, jumper"
        :total="form.totalCount"
        @size-change="handleSizeChange1"
        @current-change="handleCurrentChange1"
      />

</template>

<script setup lang="ts">
import {
  Delete,
  Edit,
  Search,
  Plus,
  Setting,
  SuccessFilled,
} from '@element-plus/icons-vue';
import { reactive, ref, onMounted } from 'vue';
import axios from 'axios';
import { useRoute, useRouter } from 'vue-router';
import { ElMessage, ElMessageBox } from 'element-plus';
const route = useRoute();
const router = useRouter();

onMounted(() => {
  getDatas();
});
const form = reactive({
  sleepInforIds: '',
  pageIndex: 1,
  pageSize: 5,
  totalCount: 0,
  totalPage:0
})
//获取查询显示后裔信息
const tableData = ref([]);
const getDatas = () => {
  console.log(form)
  axios.post("http://localhost:5039/api/SleepBegin/SearchProBegin" , form).then(res => {
    console.log(res.data)
    tableData.value = res.data.data
    form.totalCount = res.data.totalCount
    form.totalPage = res.data.totalPage
  })
}

//分页相关
const handleSizeChange1 = (val: any) => {
  form.pageSize = val;
  getDatas();
};

const handleCurrentChange1 = (val: any) => {
  form.pageIndex = val;
  getDatas();
};



</script>

<style scoped></style>
